From: Keir Fraser Date: Tue, 15 Apr 2008 15:38:25 +0000 (+0100) Subject: x86, hvm: APIC INIT handling can make use of existing hvm_vcpu_down() X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14215^2~182 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=3719d0804ff8c321af36864183286dfdf92adee2;p=xen.git x86, hvm: APIC INIT handling can make use of existing hvm_vcpu_down() helper function. Signed-off-by: Keir Fraser --- diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 69fe654fa8..97a1aaa17c 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -688,14 +688,11 @@ void hvm_vcpu_destroy(struct vcpu *v) /*free_xen_event_channel(v, v->arch.hvm_vcpu.xen_port);*/ } -static void hvm_vcpu_down(void) +void hvm_vcpu_down(struct vcpu *v) { - struct vcpu *v = current; struct domain *d = v->domain; int online_count = 0; - gdprintk(XENLOG_INFO, "VCPU%d: going offline.\n", v->vcpu_id); - /* Doesn't halt us immediately, but we'll never return to guest context. */ set_bit(_VPF_down, &v->pause_flags); vcpu_sleep_nosync(v); @@ -710,7 +707,7 @@ static void hvm_vcpu_down(void) /* ... Shut down the domain if not. */ if ( online_count == 0 ) { - gdprintk(XENLOG_INFO, "all CPUs offline -- powering off.\n"); + gdprintk(XENLOG_INFO, "All CPUs offline -- powering off.\n"); domain_shutdown(d, SHUTDOWN_poweroff); } } @@ -749,7 +746,7 @@ void hvm_hlt(unsigned long rflags) * out of this. */ if ( unlikely(!(rflags & X86_EFLAGS_IF)) ) - return hvm_vcpu_down(); + return hvm_vcpu_down(current); do_sched_op_compat(SCHEDOP_block, 0); } diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c index 222b508c9b..9bfc2cc3d1 100644 --- a/xen/arch/x86/hvm/vlapic.c +++ b/xen/arch/x86/hvm/vlapic.c @@ -291,8 +291,7 @@ static int vlapic_accept_init(struct vcpu *v) return X86EMUL_OKAY; /* Asynchronously take the VCPU down and schedule reset work. */ - set_bit(_VPF_down, &v->pause_flags); - vcpu_sleep_nosync(v); + hvm_vcpu_down(v); tasklet_schedule(&vcpu_vlapic(v)->init_tasklet); return X86EMUL_RETRY; } diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h index 24080c6cde..aee2b150ae 100644 --- a/xen/include/asm-x86/hvm/hvm.h +++ b/xen/include/asm-x86/hvm/hvm.h @@ -138,6 +138,7 @@ void hvm_domain_destroy(struct domain *d); int hvm_vcpu_initialise(struct vcpu *v); void hvm_vcpu_destroy(struct vcpu *v); +void hvm_vcpu_down(struct vcpu *v); void hvm_send_assist_req(struct vcpu *v);